package com.leetcode.August;

/**
 * @Description: 35. 搜索插入位置
 * @Author: Mr.Fxy
 * @CreateTime: 2024-09-10 20:42
 */
public class LC35搜索插入位置 {
    public int searchInsert(int[] nums, int target) {
        int i = 0, l = nums.length;
        while (i < l) {
            int m = (i + l) / 2;
            if (target > nums[m]) {
                i = m + 1;
            } else {
                l = m;
            }
        }
        return i;
    }
}
